from winproxy import ProxySetting


# 系统代理

def set_sys_proxy(proxy='127.0.0.1:8088'):
    """
    设置系统代理
    :param proxy: 代理IP和端口，127.0.0.1:8088
    """
    p = ProxySetting()
    p.enable = True
    p.server = proxy
    p.registry_write()


def close_sys_proxy():
    """关闭系统代理"""
    p = ProxySetting()
    p.enable = False
    p.registry_write()


if __name__ == '__main__':
    # set_sys_proxy()
    close_sys_proxy()
